<template>
  <div>
    <login></login>
    <!--文章-->
    <div class="block">
      <div class="title">{{ articleTitle }}</div>
      <div class="source"> {{ authorName }} <span v-if="authorInstitution&&authorName">|</span> {{ authorInstitution }}
      </div>
      <div class="mainBody" v-html="articleContent"></div>
    </div>
  </div>
</template>

<script>
//请求方法
import {api, httpPost} from '../api/http.js'
//Base64
let Base64 = require('js-base64').Base64;

import login from '../element/login'

export default {
  components: {login},
  data() {
    return {
      articleTitle: '',
      authorInstitution: '',
      authorName: '',
      articleContent: '',
    }
  },
  mounted() {
    this.obj = JSON.parse(Base64.decode(decodeURIComponent(window.location.href.split('?')[1])));
    this.obtenirDesArticles(this.obj.activityId)
  },
  methods: {
    obtenirDesArticles(activityId) {
      httpPost(api.getArticleInfoById + '?articleId=' + activityId, '',).then((res) => {
        if (res.data.code == 200) {
          if (res.data.data) {
            this.articleTitle = res.data.data.articleTitle
            this.authorInstitution = res.data.data.authorInstitution
            this.authorName = res.data.data.authorName
            this.articleContent = res.data.data.articleContent
          } else {
            this.$router.push('/404')
          }
        }
      })
    },
  }
}
</script>

<style lang="less" scoped>
.block {
  font-family: PingFangSC;
  margin: 50px 25px;

  .title {
    font-size: 34px;
    font-weight: 800;
  }

  .source {
    font-weight: 400;
    font-size: 26px;
    color: rgba(153, 153, 153, 1);
    font-style: normal;
    text-decoration: none;
    margin-top: 18px;
    margin-bottom: 60px;
  }

  .mainBody {
    font-family: PingFangSC;
    font-weight: 400;
    font-size: 26px;
    font-style: normal;
    line-height: 46px;
    text-decoration: none;

    div {
      color: rgb(66, 66, 66);
      margin-bottom: 35px;
      display: block;
    }

    .subtitle {
      font-weight: 800;
    }
  }
}
</style>
